home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / emula / arosdv19.lha / AROS / exec / remtail.c < prev    next >
C/C++ Source or Header  |  1996-10-24  |  2KB  |  92 lines

  1. /*
  2.     (C) 1995-96 AROS - The Amiga Replacement OS
  3.     $Id: remtail.c,v 1.7 1996/10/24 15:50:56 aros Exp $
  4.     $Log: remtail.c,v $
  5.     Revision 1.7  1996/10/24 15:50:56  aros
  6.     Use the official AROS macros over the __AROS versions.
  7.  
  8.     Revision 1.6  1996/10/21 20:48:22  aros
  9.     Changed struct SysBase to struct ExecBase
  10.  
  11.     Revision 1.5  1996/08/13 13:56:07  digulla
  12.     Replaced AROS_LA by AROS_LHA
  13.     Replaced some AROS_LH*I by AROS_LH*
  14.     Sorted and added includes
  15.  
  16.     Revision 1.4  1996/08/01 17:41:17  digulla
  17.     Added standard header for all files
  18.  
  19.     Desc:
  20.     Lang: english
  21. */
  22. /* I want the macros */
  23. #define AROS_ALMOST_COMPATIBLE
  24. #include "exec_intern.h"
  25.  
  26. /*****************************************************************************
  27.  
  28.     NAME */
  29.     #include <exec/lists.h>
  30.     #include <clib/exec_protos.h>
  31.  
  32.     AROS_LH1I(struct Node *, RemTail,
  33.  
  34. /*  SYNOPSIS */
  35.     AROS_LHA(struct List *, list, A0),
  36.  
  37. /*  LOCATION */
  38.     struct ExecBase *, SysBase, 44, Exec)
  39.  
  40. /*  FUNCTION
  41.     Remove the last node from a list.
  42.  
  43.     INPUTS
  44.     list - Remove the node from this list
  45.  
  46.     RESULT
  47.     The node that has been removed.
  48.  
  49.     NOTES
  50.  
  51.     EXAMPLE
  52.     struct List * list;
  53.     struct Node * tail;
  54.  
  55.     // Remove node and return it
  56.     tail = RemTail (list);
  57.  
  58.     BUGS
  59.  
  60.     SEE ALSO
  61.  
  62.     INTERNALS
  63.  
  64.     HISTORY
  65.     26-08-95    digulla created after EXEC-Routine
  66.     26-10-95    digulla adjusted to new calling scheme
  67.  
  68. ******************************************************************************/
  69. {
  70.     AROS_LIBFUNC_INIT
  71.     struct Node * node;
  72.  
  73.     assert (list);
  74.     /*
  75.     Unfortunately, there is no (quick) check that the node
  76.     is in a list.
  77.     */
  78.  
  79.     /* Get the last node of the list */
  80.     if ( (node = GetTail (list)) )
  81.     {
  82.     /* normal code to remove a node if there is one */
  83.     node->ln_Pred->ln_Succ = node->ln_Succ;
  84.     node->ln_Succ->ln_Pred = node->ln_Pred;
  85.     }
  86.  
  87.     /* return it's address or NULL if there was no node */
  88.     return node;
  89.     AROS_LIBFUNC_EXIT
  90. } /* RemTail */
  91.  
  92.